package com.newtouch.bxzs.database.synchronize.controller;

import com.newtouch.bxzs.database.synchronize.batch.BatchJobStartFactoty;
import com.newtouch.bxzs.database.synchronize.batch.job.BatchUpdateJob;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/3/2 17:17</td>
 * <td>yuanjie</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author yuanjie
 * @version 1.0.0
 * @since 1.0.0
 */
@RestController
@RequestMapping("batchUpdateController")
@Api(tags = "定时批处理修改本地数据")
public class BatchUpdateController {

    /**
     * 静态变量：系统日志
     */
    private static final Log logger = LogFactory.getLog(BatchUpdateController.class);

    @Autowired
    private BatchJobStartFactoty batchJobStartFactoty;

    @Autowired
    private BatchUpdateJob batchUpdateJob;

    @ApiOperation("广告发布撤销")
    @GetMapping("/updateAdvertisementStatus")
    public void updateAdvertisementStatus(){
        logger.info("batchUpdateController:广告发布撤销");
        batchJobStartFactoty.startJob(batchUpdateJob.advertisementJob());
    }

    @ApiOperation("产品发布撤销")
    @GetMapping("/updateProductStatus")
    public void updateProductStatus(){
        logger.info("batchUpdateController:产品发布撤销");
        batchJobStartFactoty.startJob(batchUpdateJob.productJob());
    }

    @ApiOperation("通知发布撤销")
    @GetMapping("/updateNotificationStatus")
    public void updateNotificationStatus(){
        logger.info("batchUpdateController:通知发布撤销");
        batchJobStartFactoty.startJob(batchUpdateJob.notificationJob());
    }

    @ApiOperation("知识小灵通发布撤销")
    @GetMapping("/updateKnowledgeCardStatus")
    public void updateKnowledgeCardStatus(){
        logger.info("batchUpdateController:知识小灵通发布撤销");
        batchJobStartFactoty.startJob(batchUpdateJob.knowledgeCardJob());
    }

    @ApiOperation("知识库发布撤销")
    @GetMapping("/updateKnowledgeBaseStatus")
    public void updateKnowledgeBaseStatus(){
        logger.info("batchUpdateController:知识库发布撤销");
        batchJobStartFactoty.startJob(batchUpdateJob.knowledgeBaseJob());
    }

    @ApiOperation("提醒升级")
    @GetMapping("/remindToUpgrade")
    public void remindToUpgrade(){
        logger.info("batchUpdateController:提醒升级");
        batchJobStartFactoty.startJob(batchUpdateJob.remindToUpgradeJob());
    }

    @ApiOperation("结束营销活动")
    @GetMapping("/getMarketingActivity")
    public void getMarketingActivity(){
        logger.info("batchUpdateController:结束营销活动");
        batchJobStartFactoty.startJob(batchUpdateJob.finishMarketingActivityJob());
    }

    @ApiOperation("结束营销会议")
    @GetMapping("/getMarketingConference")
    public void getMarketingConference(){
        logger.info("batchUpdateController:结束营销会议");
        batchJobStartFactoty.startJob(batchUpdateJob.finishMarketingConferenceJob());
    }

    @ApiOperation("发布/撤销课程信息")
    @GetMapping("/updateCourseStatus")
    public void updateCourseStatus(){
        logger.info("batchUpdateController:发布/撤销课程信息");
        batchJobStartFactoty.startJob(batchUpdateJob.updateCourseStatusJob());
    }

    @ApiOperation("发布/撤销考试信息")
    @GetMapping("/updateaExaminationStatus")
    public void updateaExaminationStatus(){
        logger.info("batchUpdateController:发布/撤销考试信息");
        batchJobStartFactoty.startJob(batchUpdateJob.updateExaminationStatusJob());
    }
}
